import sys
from PyQt5.QtWidgets import QHBoxLayout, QMainWindow, QApplication, QWidget
from PyQt5.QtWidgets import QPushButton
class QiutApplication(QMainWindow):
    def __init__(self):
        super().__init__()

        self.resize(350, 120)
        self.setWindowTitle("Qiut app")

        self.button1 = QPushButton("cancel")
        self.button1.clicked.connect(self.onClicked_Button)

        layout = QHBoxLayout()
        layout.addWidget(self.button1)
        mainFrame = QWidget()
        mainFrame.setLayout(layout)
        self.setCentralWidget(mainFrame)
    def onClicked_Button(self):
        sender = self.sender()
        print(sender.text() + "button is clicked")
        app = QApplication.instance()
        app.quit()

if __name__ == '__main__':

    app = QApplication(sys.argv)
    ex = QiutApplication()
    ex.show()
    sys.exit(app.exec_())